<!doctype html>
<html class="no-js" lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>eh documentation</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
	      <link rel="stylesheet" href="../styles/style.css">
    </head>
    <body>

        <div class="navbar navbar-default navbar-fixed-top visible-xs">
            <a href="../" class="navbar-brand">eh documentation</a>
            <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
        </div>

        <div class="xs-menu menu" id="mobile-menu">
                <div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search">
</div>
            <compodoc-menu></compodoc-menu>
        </div>

        <div class="container-fluid main">
           <div class="row main">
               <div class="hidden-xs menu">
                   <compodoc-menu mode="normal"></compodoc-menu>
               </div>
               <!-- START CONTENT -->
               <div class="content injectable">
                   <div class="content-data">







<ol class="breadcrumb">
  <li>Injectables</li>
  <li>UserEffects</li>
</ol>

<ul class="nav nav-tabs" role="tablist">
        <li class="active">
            <a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
        </li>
        <li >
            <a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
        </li>
</ul>

<div class="tab-content">
    <div class="tab-pane fade active in" id="c-info">
        <p class="comment">
            <h3>File</h3>
        </p>
        <p class="comment">
            <code>src/app/user/store/effects/user.effects.ts</code>
        </p>



            <section>
    <h3 id="index">Index</h3>
    <table class="table table-sm table-bordered index-table">
        <tbody>
                <tr>
                    <td class="col-md-4">
                        <h6><b>Properties</b></h6>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <ul class="index-list">
                            <li>
                                <a href="#enroll$">enroll$</a>
                            </li>
                            <li>
                                <a href="#enrollError$">enrollError$</a>
                            </li>
                            <li>
                                <a href="#enrollSuccess$">enrollSuccess$</a>
                            </li>
                            <li>
                                <a href="#findUser$">findUser$</a>
                            </li>
                            <li>
                                <a href="#findUserError$">findUserError$</a>
                            </li>
                            <li>
                                <a href="#findUserSuccess$">findUserSuccess$</a>
                            </li>
                            <li>
                                <a href="#login$">login$</a>
                            </li>
                            <li>
                                <a href="#loginError$">loginError$</a>
                            </li>
                            <li>
                                <a href="#loginSuccess$">loginSuccess$</a>
                            </li>
                        </ul>
                    </td>
                </tr>






        </tbody>
    </table>
</section>

            <section>
    <h3 id="constructor">Constructor</h3>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
<code>constructor(actions$: Actions, userService: , router: <a href="https://angular.io/api/router/Router" target="_blank">Router</a>)</code>
                    </td>
                </tr>
                        <tr>
                            <td class="col-md-4">
                                <div class="io-line">Defined in <a href="" data-line="10" class="link-to-prism">src/app/user/store/effects/user.effects.ts:10</a></div>
                            </td>
                        </tr>

                <tr>
                    <td class="col-md-4">
                            <div>
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                    <td>Type</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>actions$</td>
                                                  
                                                        <td>
                                                                    <code>Actions</code>
                                                        </td>
                                                  
                                                    <td>
                                                            No
                                                    </td>
                                                    
                                                </tr>
                                                <tr>
                                                        <td>userService</td>
                                                  
                                                        <td>
                                                        </td>
                                                  
                                                    <td>
                                                            No
                                                    </td>
                                                    
                                                </tr>
                                                <tr>
                                                        <td>router</td>
                                                  
                                                        <td>
                                                                    <code><a href="https://angular.io/api/router/Router" target="_blank" >Router</a></code>
                                                        </td>
                                                  
                                                    <td>
                                                            No
                                                    </td>
                                                    
                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                    </td>
                </tr>
            </tbody>
        </table>
</section>


            <section>
    
        <h3 id="inputs">
            Properties
        </h3>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="enroll$"></a>
                        <span class="name">
                            <b>
                            enroll$
                            </b>
                            <a href="#enroll$"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>enroll$:     <code></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Default value : </i><code>this.actions$.pipe(
    ofType&lt;UserActions.Enroll&gt;(UserActions.UserActionTypes.Enroll),
    map(action &#x3D;&gt; action.payload.req),
    exhaustMap((req: IEnrollRequest) &#x3D;&gt; {
      return this.userService.enroll(req).pipe(
        map((res: IEnrollResponse) &#x3D;&gt; new UserActions.EnrollSuccess({ res })),
        catchError(error &#x3D;&gt; of(new UserActions.EnrollError({ error }))),
      );
    }),
  )</code>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Decorators : </i><code>Effect</code>
                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="14" class="link-to-prism">src/app/user/store/effects/user.effects.ts:14</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="enrollError$"></a>
                        <span class="name">
                            <b>
                            enrollError$
                            </b>
                            <a href="#enrollError$"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>enrollError$:     <code></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Default value : </i><code>this.actions$.pipe(
    ofType(UserActions.UserActionTypes.EnrollError),
    tap(() &#x3D;&gt; {
      // do something
    }),
  )</code>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Decorators : </i><code>Effect</code>
                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="34" class="link-to-prism">src/app/user/store/effects/user.effects.ts:34</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="enrollSuccess$"></a>
                        <span class="name">
                            <b>
                            enrollSuccess$
                            </b>
                            <a href="#enrollSuccess$"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>enrollSuccess$:     <code></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Default value : </i><code>this.actions$.pipe(
    ofType(UserActions.UserActionTypes.EnrollSuccess),
    tap(() &#x3D;&gt; {
      // do something
    }),
  )</code>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Decorators : </i><code>Effect</code>
                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="26" class="link-to-prism">src/app/user/store/effects/user.effects.ts:26</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="findUser$"></a>
                        <span class="name">
                            <b>
                            findUser$
                            </b>
                            <a href="#findUser$"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>findUser$:     <code></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Default value : </i><code>this.actions$.pipe(
    ofType&lt;UserActions.FindUser&gt;(UserActions.UserActionTypes.FindUser),
    map(action &#x3D;&gt; action.payload.user),
    exhaustMap((user: IFindUser) &#x3D;&gt; {
      console.log(user, 9878978979888989);
      return this.userService.find(user).pipe(
        map((user: IFindUser) &#x3D;&gt; new UserActions.FindUserSuccess({ user })),
        catchError(error &#x3D;&gt; of(new UserActions.FindUserError({ error }))),
      );
    }),
  )</code>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Decorators : </i><code>Effect</code>
                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="70" class="link-to-prism">src/app/user/store/effects/user.effects.ts:70</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="findUserError$"></a>
                        <span class="name">
                            <b>
                            findUserError$
                            </b>
                            <a href="#findUserError$"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>findUserError$:     <code></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Default value : </i><code>this.actions$.pipe(
    ofType(UserActions.UserActionTypes.FindUserError),
    tap(() &#x3D;&gt; {
      //do something
    }),
  )</code>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Decorators : </i><code>Effect</code>
                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="91" class="link-to-prism">src/app/user/store/effects/user.effects.ts:91</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="findUserSuccess$"></a>
                        <span class="name">
                            <b>
                            findUserSuccess$
                            </b>
                            <a href="#findUserSuccess$"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>findUserSuccess$:     <code></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Default value : </i><code>this.actions$.pipe(
    ofType(UserActions.UserActionTypes.FindUserSuccess),
    tap(() &#x3D;&gt; {
      //do something
    }),
  )</code>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Decorators : </i><code>Effect</code>
                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="83" class="link-to-prism">src/app/user/store/effects/user.effects.ts:83</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="login$"></a>
                        <span class="name">
                            <b>
                            login$
                            </b>
                            <a href="#login$"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>login$:     <code></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Default value : </i><code>this.actions$.pipe(
    ofType&lt;UserActions.Login&gt;(UserActions.UserActionTypes.Login),
    map(action &#x3D;&gt; action.payload.req),
    exhaustMap((req: ILoginRequest) &#x3D;&gt; {
      return this.userService.login(req).pipe(
        map((res: ILoginResponse) &#x3D;&gt; new UserActions.LoginSuccess({ res })),
        catchError(error &#x3D;&gt; of(new UserActions.LoginError({ error }))),
      );
    }),
  )</code>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Decorators : </i><code>Effect</code>
                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="42" class="link-to-prism">src/app/user/store/effects/user.effects.ts:42</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="loginError$"></a>
                        <span class="name">
                            <b>
                            loginError$
                            </b>
                            <a href="#loginError$"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>loginError$:     <code></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Default value : </i><code>this.actions$.pipe(
    ofType(UserActions.UserActionTypes.LoginError),
    tap(() &#x3D;&gt; {
      // do something
    }),
  )</code>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Decorators : </i><code>Effect</code>
                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="62" class="link-to-prism">src/app/user/store/effects/user.effects.ts:62</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="loginSuccess$"></a>
                        <span class="name">
                            <b>
                            loginSuccess$
                            </b>
                            <a href="#loginSuccess$"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>loginSuccess$:     <code></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Default value : </i><code>this.actions$.pipe(
    ofType(UserActions.UserActionTypes.LoginSuccess),
    tap(() &#x3D;&gt; {
      // do something
    }),
  )</code>
                        </td>
                    </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Decorators : </i><code>Effect</code>
                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="54" class="link-to-prism">src/app/user/store/effects/user.effects.ts:54</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
</section>

    </div>


    <div class="tab-pane fade  tab-source-code" id="c-source">
        <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { Injectable, Inject } from &#x27;@angular/core&#x27;;
import { Router } from &#x27;@angular/router&#x27;;
import { Actions, Effect, ofType } from &#x27;@ngrx/effects&#x27;;
import { of } from &#x27;rxjs&#x27;;
import { catchError, exhaustMap, map, tap } from &#x27;rxjs/operators&#x27;;
import { UserActions } from &#x27;../actions&#x27;;
import { ILoginRequest, ILoginResponse, IFindUser, IEnrollRequest, IEnrollResponse } from &#x27;@/user/store/models/user&#x27;;

@Injectable()
export class UserEffects {
  constructor(private actions$: Actions, @Inject(&#x27;UserService&#x27;) private userService, private router: Router) {}

  @Effect()
  enroll$ &#x3D; this.actions$.pipe(
    ofType&lt;UserActions.Enroll&gt;(UserActions.UserActionTypes.Enroll),
    map(action &#x3D;&gt; action.payload.req),
    exhaustMap((req: IEnrollRequest) &#x3D;&gt; {
      return this.userService.enroll(req).pipe(
        map((res: IEnrollResponse) &#x3D;&gt; new UserActions.EnrollSuccess({ res })),
        catchError(error &#x3D;&gt; of(new UserActions.EnrollError({ error }))),
      );
    }),
  );

  @Effect({ dispatch: false })
  enrollSuccess$ &#x3D; this.actions$.pipe(
    ofType(UserActions.UserActionTypes.EnrollSuccess),
    tap(() &#x3D;&gt; {
      // do something
    }),
  );

  @Effect({ dispatch: false })
  enrollError$ &#x3D; this.actions$.pipe(
    ofType(UserActions.UserActionTypes.EnrollError),
    tap(() &#x3D;&gt; {
      // do something
    }),
  );

  @Effect()
  login$ &#x3D; this.actions$.pipe(
    ofType&lt;UserActions.Login&gt;(UserActions.UserActionTypes.Login),
    map(action &#x3D;&gt; action.payload.req),
    exhaustMap((req: ILoginRequest) &#x3D;&gt; {
      return this.userService.login(req).pipe(
        map((res: ILoginResponse) &#x3D;&gt; new UserActions.LoginSuccess({ res })),
        catchError(error &#x3D;&gt; of(new UserActions.LoginError({ error }))),
      );
    }),
  );

  @Effect({ dispatch: false })
  loginSuccess$ &#x3D; this.actions$.pipe(
    ofType(UserActions.UserActionTypes.LoginSuccess),
    tap(() &#x3D;&gt; {
      // do something
    }),
  );

  @Effect({ dispatch: false })
  loginError$ &#x3D; this.actions$.pipe(
    ofType(UserActions.UserActionTypes.LoginError),
    tap(() &#x3D;&gt; {
      // do something
    }),
  );

  @Effect()
  findUser$ &#x3D; this.actions$.pipe(
    ofType&lt;UserActions.FindUser&gt;(UserActions.UserActionTypes.FindUser),
    map(action &#x3D;&gt; action.payload.user),
    exhaustMap((user: IFindUser) &#x3D;&gt; {
      console.log(user, 9878978979888989);
      return this.userService.find(user).pipe(
        map((user: IFindUser) &#x3D;&gt; new UserActions.FindUserSuccess({ user })),
        catchError(error &#x3D;&gt; of(new UserActions.FindUserError({ error }))),
      );
    }),
  );

  @Effect({ dispatch: false })
  findUserSuccess$ &#x3D; this.actions$.pipe(
    ofType(UserActions.UserActionTypes.FindUserSuccess),
    tap(() &#x3D;&gt; {
      //do something
    }),
  );

  @Effect({ dispatch: false })
  findUserError$ &#x3D; this.actions$.pipe(
    ofType(UserActions.UserActionTypes.FindUserError),
    tap(() &#x3D;&gt; {
      //do something
    }),
  );
}
</code></pre>
    </div>

</div>











                   </div><div class="search-results">
    <div class="has-results">
        <h1 class="search-results-title"><span class='search-results-count'></span> result-matching "<span class='search-query'></span>"</h1>
        <ul class="search-results-list"></ul>
    </div>
    <div class="no-results">
        <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
    </div>
</div>
</div>
               <!-- END CONTENT -->
           </div>
       </div>

       <script>
            var COMPODOC_CURRENT_PAGE_DEPTH = 1;
            var COMPODOC_CURRENT_PAGE_CONTEXT = 'injectable';
            var COMPODOC_CURRENT_PAGE_URL = 'UserEffects.html';
       </script>

       <script src="../js/libs/custom-elements.min.js"></script>
       <script src="../js/libs/lit-html.js"></script>
       <script src="../js/menu-wc.js"></script>

       <script src="../js/libs/bootstrap-native.js"></script>

       <script src="../js/libs/es6-shim.min.js"></script>
       <script src="../js/libs/EventDispatcher.js"></script>
       <script src="../js/libs/promise.min.js"></script>
       <script src="../js/libs/zepto.min.js"></script>

       <script src="../js/compodoc.js"></script>

       <script src="../js/tabs.js"></script>
       <script src="../js/menu.js"></script>
       <script src="../js/libs/clipboard.min.js"></script>
       <script src="../js/libs/prism.js"></script>
       <script src="../js/sourceCode.js"></script>
          <script src="../js/search/search.js"></script>
          <script src="../js/search/lunr.min.js"></script>
          <script src="../js/search/search-lunr.js"></script>
          <script src="../js/search/search_index.js"></script>
       <script src="../js/lazy-load-graphs.js"></script>


    </body>
</html>
